Open
Conversation
e203d8b to
97e2376
Compare
97e2376 to
9e43da9
Compare
... and everything else that it depends on.
None of these required any changes to the dataflow libraries, so it seemed easiest to put them in their own commit.
These were causing the repo `gufolabs/noc` to spend ~30 seconds evaluating `ControlFlowNode.strictlyDominates`. Just in case, I added `overlay[caller] to the other instances of `pragma[inline]` as well.
On `keras-team/keras`, this was producing ~200 million intermediate tuples in order to produce a total of ... 2 tuples. After the refactor, max intermediate tuple count is ~80k for the charpred (and 4 for the new helper predicate).
This caused a ~30x blowup in intermediate tuples, now back to baseline.
c949417 to
304cd12
Compare
0ca3f60 to
cd62cda
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes the CodeQL Python analysis overlay-aware by adding overlay annotations throughout the Python QL libraries. The changes enable overlay evaluation, which should significantly improve performance when a base database already exists. According to the PR description, AST, CFG, SSA, and DataFlow::Node are marked as local, while call graph-related functionality remains global.
Changes:
- Added
overlay[local],overlay[local?],overlay[global], andoverlay[caller]annotations to Python QL library modules, classes, and predicates - Introduced join-order optimization helper predicates with
pragma[nomagic]to maintain performance after overlay annotations - Added final class aliases and converted to
instanceofpatterns to enable extending overlay[local] classes from non-overlay contexts
Reviewed changes
Copilot reviewed 55 out of 55 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| python/ql/lib/change-notes/2026-02-18-add-overlay-annotations.md | Documents the overlay evaluation compatibility changes |
| python/ql/lib/semmle/python/**/*.qll | Adds overlay[local] module annotations to AST, CFG, SSA, and dataflow libraries |
| python/ql/lib/semmle/python/dataflow/new/**/*.qll | Adds overlay[local] to dataflow components and overlay[global] to call graph-related predicates |
| python/ql/lib/semmle/python/frameworks/*.qll | Adds overlay[local?] module annotations and join-order helpers to framework models |
| python/ql/lib/semmle/python/objects/TObject.qll | Adds join-order helper predicate for missing_imported_module |
| python/ql/lib/semmle/python/internal/CachedStages.qll | Adds overlay[local] to AST and DataFlow stage predicates |
| python/ql/src/analysis/ImportFailure.ql | Introduces FinalControlFlowNode alias and removes override keyword |
| python/ql/src/Variables/LoopVariableCapture/LoopVariableCaptureQuery.qll | Introduces FinalAstNode alias and converts to instanceof pattern |
| python/ql/lib/analysis/DefinitionTracking.qll | Introduces FinalExpr alias for NiceLocationExpr |
| python/ql/test/library-tests/**/*.qll | Adds overlay annotations to test helper modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the CodeQL Python analysis overlay-aware, up to and including
DataFlow::Node.The rough rule of thumb in these changes is:
DataFlow::Nodeare all local,Finally, after adding all of the overlay annotations, a few join-order fixes were needed in order to get performance back to normal. These have been added at the end of this PR.